/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.smarttmt.suite.web.beans;

import org.apache.commons.lang3.StringUtils;

/**
 *
 * @author Nicolás Rubén Caballero Ortega (ingeniero.desarrollo004@smarttmt.com - helaman58@gmail.com)
 */

@javax.inject.Named(value = "sessionControllerBean")
@javax.enterprise.context.SessionScoped
public class SessionController implements java.io.Serializable {

    @javax.inject.Inject ApplicationController applicationController;
    
    private String implementation;
    private String client;
    private String log;

    public SessionController() {
    }
    
    @javax.annotation.PostConstruct
    public void initSessionController(){
    
    }
    
    public void loadParametersSession() throws Exception{
        String impl = com.smarttmt.suite.web.utilities.FacesUtils.getSessionParameter(com.smarttmt.suite.web.domain.Constants.IMPLEMENTATION);
        String cl = com.smarttmt.suite.web.utilities.FacesUtils.getSessionParameter(com.smarttmt.suite.web.domain.Constants.CLIENT);
        String lg = com.smarttmt.suite.web.utilities.FacesUtils.getSessionParameter(com.smarttmt.suite.web.domain.Constants.LOG);
        
        if(StringUtils.isNotBlank(impl)){
            System.out.println("implementation: "+impl);
            setImplementation(impl);
        }else{
            throw new Exception("No viene el parámetro impl");
        }
        
        if(StringUtils.isNotBlank(cl)){
            System.out.println("client: "+cl);
            setClient(cl);
        }else{
            throw new Exception("No viene el parámetro client");
        }
        
        if(StringUtils.isNotBlank(lg)){
            System.out.println("log: "+lg);
            setLog(lg);
        }
    }

    public ApplicationController getApplicationController() {
        return applicationController;
    }

    public void setApplicationController(ApplicationController applicationController) {
        this.applicationController = applicationController;
    }

    public String getImplementation() {
        return implementation;
    }

    public void setImplementation(String implementation) {
        this.implementation = implementation;
    }

    public String getClient() {
        return client;
    }

    public void setClient(String client) {
        this.client = client;
    }

    public String getLog() {
        return log;
    }

    public void setLog(String log) {
        this.log = log;
    }
    
    
}
